var ajaxHelper = require("../../utils/ajaxhelp");
const serviceUrl = getApp().globalData.serviceUrl;
let token = wx.getStorageSync('token');


const GetDoctorList = () => {
    token = wx.getStorageSync('token');
    return ajaxHelper.promiseRequst(serviceUrl + "/api/Doctor/GetDoctorList",
        { 'Authorization': 'Bearer ' + token }, "GET", {})
}

const GetDoctorById = (id) => {
    token = wx.getStorageSync('token');
    return ajaxHelper.promiseRequst(serviceUrl + "/api/Doctor/GetDoctorById",
        {}, "GET", { doctorId: id })
}
const AddDoctor = (obj = {}) => {
    token = wx.getStorageSync('token');
    return ajaxHelper.promiseRequst(serviceUrl + "/api/Doctor/AddDoctor",
        { 'Authorization': 'Bearer ' + token }, "POST", obj)
}
const ModDoctor = (obj = {}) => {
    token = wx.getStorageSync('token');
    return ajaxHelper.promiseRequst(serviceUrl + "/api/Doctor/ModDoctor",
        { 'Authorization': 'Bearer ' + token }, "POST", obj)
}
const GetAreaByConditions = () => {
    token = wx.getStorageSync('token');
    return ajaxHelper.promiseRequst(serviceUrl + "/api/Doctor/QryAreaByConditions",
        { 'Authorization': 'Bearer ' + token }, "GET", {})
}
const GetDoctorListByConditions = (liveness, district,isml,startTime,endTime,type,doctorname) => {
    token = wx.getStorageSync('token');
    return ajaxHelper.promiseRequst(serviceUrl + "/api/Doctor/GetDoctorListByConditions",
      { 'Authorization': 'Bearer ' + token }, "GET", { liveness: liveness, district: district, isml: isml, startTime: startTime, endTime: endTime, type: type, doctorname: doctorname })
}
const QryNetDoctorsStatistic = (startdata, enddata) => {
    token = wx.getStorageSync('token');
    return ajaxHelper.promiseRequst(serviceUrl + "/api/NetDoctorsStatistic/QryNetDoctorsStatistic",
        { 'Authorization': 'Bearer ' + token }, "GET", { startdata: startdata, enddata: enddata })
}
module.exports = {
    GetDoctorList,
    GetDoctorById,
    GetAreaByConditions,
    AddDoctor,
    GetDoctorListByConditions,
    ModDoctor,
	QryNetDoctorsStatistic,
}